package com.emellend.api.list;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
/**
 *一个简单的内容识别，对于"-"开头的不允许成为单独的条目。
 *	areAllItemsEnabled
 *	isEnabled
 * @author Administrator
 *
 */
public class List5 extends ListActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setListAdapter(new MyListAdapter());
	}
	private class MyListAdapter extends BaseAdapter{

		public int getCount() {
			return mStrings.length;
		}

		public Object getItem(int position) {
			return position;
		}

		public long getItemId(int position) {
			return position;
		}
		@Override
		public boolean areAllItemsEnabled() {
			return false;
		}
		@Override
		public boolean isEnabled(int position) {
			return !mStrings[position].startsWith("-");
		}
		public View getView(int position, View convertView, ViewGroup parent) {
			TextView view;
			if (convertView==null) {
				view=(TextView) LayoutInflater.from(List5.this).inflate(android.R.layout.simple_list_item_1, null);
			} else {
				view=(TextView) convertView;
			}
			view.setText(mStrings[position]);
			return view;
		}
		
	}
	private String[] mStrings = {
            "----------",
            "----------",
            "Abbaye de Belloc",
            "Abbaye du Mont des Cats",
            "Abertam",
            "----------",
            "Abondance",
            "----------",
            "Ackawi",
            "Acorn",
            "Adelost",
            "Affidelice au Chablis",
            "Afuega'l Pitu",
            "Airag",
            "----------",
            "Airedale",
            "Aisy Cendre",
            "----------",
            "Allgauer Emmentaler",
            "Alverca",
            "Ambert",
            "American Cheese",
            "Ami du Chambertin",
            "----------",
            "----------",
            "Anejo Enchilado",
            "Anneau du Vic-Bilh",
            "Anthoriro",
            "----------",
            "----------"
    };
}
